<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="de.marmaro.krt.ffupdater"
    android:installLocation="auto">
    <!-- Touchscreen is enabled by default but not always needed -->
    <uses-feature
        android:name="android.hardware.touchscreen"
        android:required="false" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
    <uses-permission android:name="android.permission.UPDATE_PACKAGES_WITHOUT_USER_ACTION" />

    <!-- Necessary for gaining read/write access to "Android/data/de.marmaro.krt.ffupdater/files/"
         on older devices. For Amazon devices, I have to download the APK files into this folder
         or I'll get a "Permission Denial: reading ... DownloadProvider uri ... requires
         android.permission.ACCESS_ALL_DOWNLOADS or grantUriPermission()" exception.
         -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        tools:ignore="ScopedStorage" />

    <!-- If FFUpdater wants to check if an app is installed, this app must be listed here -->
    <!-- https://developer.android.com/about/versions/11/privacy/package-visibility -->
    <queries>
        <package android:name="com.brave.browser" />
        <package android:name="com.brave.browser_beta" />
        <package android:name="com.brave.browser_nightly" />
        <package android:name="com.kiwibrowser.browser" />
        <package android:name="com.vivaldi.browser" />
        <package android:name="de.marmaro.krt.ffupdater" />
        <package android:name="io.github.forkmaintainers.iceraven" />
        <package android:name="mozilla.lockbox" />
        <package android:name="org.bromite.bromite" />
        <package android:name="org.bromite.webview" />
        <package android:name="org.mozilla.fenix" />
        <package android:name="org.mozilla.firefox" />
        <package android:name="org.mozilla.firefox_beta" />
        <package android:name="org.mozilla.focus" />
        <package android:name="org.mozilla.klar" />
        <package android:name="org.mozilla.rocket" />
        <package android:name="org.ungoogled.chromium.stable" />
        <package android:name="us.spotco.fennec_dos" />
    </queries>

    <application
        android:allowBackup="true"
        android:fullBackupContent="@xml/backup_descriptor"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:networkSecurityConfig="@xml/network_security_config"
        android:roundIcon="@mipmap/ic_launcher"
        android:supportsRtl="true"
        android:usesCleartextTraffic="false"
        android:manageSpaceActivity=".ManageStorageActivity"
        tools:targetApi="Q">
        <activity
            android:name=".ManageStorageActivity"
            android:label="Manage Storage"
            android:theme="@style/main_activity__theme" />
        <activity
            android:name=".CrashReportActivity"
            android:label="FFUpdater Crash Reporter"
            android:theme="@style/crash_report__theme" />
        <activity
            android:name=".SettingsActivity"
            android:label="@string/settings__activity_label"
            android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar" />
        <activity
            android:name=".InstallActivity"
            android:label="@string/install_activity_label"
            android:launchMode="singleTop"
            android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar" />
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:theme="@style/main_activity__theme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="de.marmaro.krt.ffupdater.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>

        <receiver
            android:name=".EolAppsWarnerReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            </intent-filter>
        </receiver>
    </application>

</manifest>